﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Mvc;
using EraNet.Common;
namespace EraNet.WebApp.AppCore
{
    public class IMSBasePage : Controller
    {
        /// <summary>
        /// Action执行前判断
        /// </summary>
        /// <param name="filterContext"></param>
        protected override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            // url

            string controller = filterContext.RouteData.Values["controller"].ToString().ToLower();
            string action = filterContext.RouteData.Values["action"].ToString().ToLower();

            //判断是否登录排除index页面跟验证码
            if (string.IsNullOrEmpty(EraNet.Common.Utility.GetCookie("DriveSchool_Member")) && action != "index" && action != "createimagecode" && action != "logonschool")
            {
                filterContext.Result = RedirectToRoute("IMS_default", new { Controller = "Account", Action = "Index" });
            }


            base.OnActionExecuting(filterContext);

        }
    }
}
